package com.zbkj.common.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @Auther:
 * @Date: 2024/7/6 16:18
 * @Description: 项目状态枚举
 */
public enum ProjectStatusEnum {
    //0 待估算 10 已退回 20 估算中 30 估算完成 40 报告中 50 已完成
    TO_ESTIMATE(0),
    WITHDRAWN(10),
    IN_ESTIMATE(20),
    COMPLET_ESTIMATE(30),
    IN_REPORT(40),
    FINISH(50);

    @Getter
    private int status;

    ProjectStatusEnum(int status) {
        this.status = status;
    }

    /**
     * 是否为待估算状态
     * @param status
     * @return
     */
    public static boolean isToEstimate(Integer status) {
        return Objects.nonNull(status) && TO_ESTIMATE.status == status.intValue();
    }

    /**
     * 是否为撤回状态
     * @param status
     * @return
     */
    public static boolean isWithdrawn(Integer status) {
        return Objects.nonNull(status) && WITHDRAWN.status == status.intValue();
    }

    public static boolean isInEstimate(Integer status) {
        return Objects.nonNull(status) && IN_ESTIMATE.status == status.intValue();
    }

    public static boolean isCompletEstimate(Integer status) {
        return Objects.nonNull(status) && COMPLET_ESTIMATE.status == status.intValue();
    }

    public static boolean isInReport(Integer status) {
        return Objects.nonNull(status) && IN_REPORT.status == status.intValue();
    }

    public static boolean isFinish(Integer status) {
        return Objects.nonNull(status) && FINISH.status == status.intValue();
    }

    public static boolean estimateSubmitCheck(Integer status) {
        return Objects.nonNull(status)
                && TO_ESTIMATE.status != status.intValue()
                && WITHDRAWN.status != status.intValue();
    }
}
